import cv2
import numpy as np
import matplotlib.pyplot as plt

img = cv2.imread('44.PNG')
src = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)

height = src.shape[0]
width = src.shape[1]

numHeight = height // 32
numwidth = width // 32

new_img = np.zeros((height, width, 3), np.uint8)

for i in range(32):
    y = i * numHeight
    for j in range(32):
        x = j * numwidth
        b = src[y, x][0]
        g = src[y, x][1]
        r = src[y, x][2]
        for n in range(numHeight):
            for m in range(numwidth):
                new_img[y +n, x + m][0] = np.uint8(b)
                new_img[y +n, x + m][1] = np.uint8(g)
                new_img[y+ n, x + m][2] = np.uint8(r)

titles = ['src', 'Sampling']
images = [src, new_img]
plt.figure(figsize=(10, 4))
for i in range(2):
    plt.subplot(1, 2, i + 1)
    plt.imshow(images[i])
    plt.title(titles[i])
    plt.axis('off')

plt.show()